﻿#ifndef GRADIENTBUTTON_H
#define GRADIENTBUTTON_H
#include <QPushButton>
#include <QPaintEvent>
#include <QTimer>

class GradientButton : public QPushButton
{
    Q_OBJECT
public:
    GradientButton(QWidget *parent = nullptr);
    void startAnimation(bool isStart);

protected:
    void paintEvent(QPaintEvent *event);

private slots:
    void updateStyle();

private:
    double calculateRotationAngle(double x, double y, int milliseconds);

    QTimer* m_Timer;
    double angle; // 当前角度
    bool GradientColor;
};

#endif // GRADIENTBUTTON_H
